<basics2:ChildWindow
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:basics2="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    mc:Ignorable="d"
    xmlns:Rawr="clr-namespace:Rawr;assembly=Rawr.Base"
    x:Class="Rawr.UI.ItemBrowser"
    Title="Item Browser"
    Width="600" Height="400"
    >

    <basics2:ChildWindow.Resources>
        <DataTemplate x:Key="DataTemplateItemGridRowDetails">
            <toolkit:DockPanel Background="White" LastChildFill="True">
                <Image Width="32" Height="32" Margin="5,5,5,5" toolkit:DockPanel.Dock="Left" Source="{Binding Converter={StaticResource IconPathConverter}, ConverterParameter=IconPath}"/>
                <Rectangle toolkit:DockPanel.Dock="Right" Width="20" Height="20" Margin="4" Fill="{Binding Converter={StaticResource GemColorConverter}, ConverterParameter=1}"/>
                <Rectangle toolkit:DockPanel.Dock="Right" Width="20" Height="20" Margin="4" Fill="{Binding Converter={StaticResource GemColorConverter}, ConverterParameter=2}"/>
                <Rectangle toolkit:DockPanel.Dock="Right" Width="20" Height="20" Margin="4" Fill="{Binding Converter={StaticResource GemColorConverter}, ConverterParameter=3}"/>
                <StackPanel Margin="5" VerticalAlignment="Center">
                    <TextBlock Text="{Binding Stats}" TextWrapping="Wrap"/>
                    <!--<TextBlock Text="{Binding LocationInfo}" TextWrapping="Wrap"/>-->
                </StackPanel>
            </toolkit:DockPanel>
        </DataTemplate>
        <DataTemplate x:Key="DataTemplateItemGridCellName">
            <TextBlock Text="{Binding Name}" Foreground="{Binding Converter={StaticResource ItemQualityConverter}}"
                                VerticalAlignment="Center" FontWeight="Bold" Padding="5,0,5,0" />
        </DataTemplate>
    </basics2:ChildWindow.Resources>

    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Button x:Name="BT_LargeView" Content="Large View" Click="BT_LargeView_Click" Width="75" HorizontalAlignment="Right" Grid.Row="3" Margin="0,4,81,4" d:LayoutOverrides="Height, VerticalMargin" Visibility="Visible"/>
        <Button x:Name="BT_SmallView" Content="Small View" Click="BT_SmallView_Click" Width="75" HorizontalAlignment="Right" Grid.Row="3" Margin="0,4,81,4" d:LayoutOverrides="Height, VerticalMargin" Visibility="Collapsed" />
        <Button x:Name="DoneButton" Content="Done" Click="DoneButton_Click" Width="75" HorizontalAlignment="Right" Grid.Row="3" Margin="0,4,4,4" d:LayoutOverrides="Height, VerticalMargin" />
        <data:DataGrid x:Name="ItemGrid" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.Row="2" Margin="4,4,4,4"
        CanUserResizeColumns="True" CanUserSortColumns="True" CanUserReorderColumns="True" AutoGenerateColumns="False" RowDetailsVisibilityMode="VisibleWhenSelected"
        SelectionChanged="ItemGrid_SelectionChanged" GridLinesVisibility="Horizontal" AreRowDetailsFrozen="True" IsReadOnly="True" RowDetailsTemplate="{StaticResource DataTemplateItemGridRowDetails}">
            <data:DataGrid.Columns>
                <data:DataGridTemplateColumn Header="Name" CellTemplate="{StaticResource DataTemplateItemGridCellName}" SortMemberPath="Name" />
                <data:DataGridTextColumn Header="Item ID" Binding="{Binding Id}" IsReadOnly="True" />
                <data:DataGridTextColumn Header="Level" Binding="{Binding ItemLevel}" IsReadOnly="True" />
                <data:DataGridTextColumn Header="Slot" Binding="{Binding Slot}" IsReadOnly="True" />
                <data:DataGridTextColumn Header="Type" Binding="{Binding Type}" IsReadOnly="True" />
                <data:DataGridTextColumn Header="Bind" Binding="{Binding Bind}" IsReadOnly="True" />
                <data:DataGridTextColumn Header="Source" Binding="{Binding GetFullLocationDesc}" IsReadOnly="True" />
            </data:DataGrid.Columns>
        </data:DataGrid>
        <toolkit:DockPanel LastChildFill="True" Margin="2,2,2,2">
            <TextBlock toolkit:DockPanel.Dock="Left" VerticalAlignment="Center" Margin="2,2,2,2" Text="Name, Id or Source:"/>
            <CheckBox x:Name="CK_UseRegex" Content="Use Regex" toolkit:DockPanel.Dock="Right" Checked="CK_UseRegex_CheckedChanged" Unchecked="CK_UseRegex_CheckedChanged" VerticalAlignment="Center"/>
            <TextBox x:Name="NameText" toolkit:DockPanel.Dock="Right" TextChanged="NameText_TextChanged" Margin="2,2,2,2"/>
        </toolkit:DockPanel>
        <toolkit:Expander Margin="4,2,4,2" Grid.Row="1" Header="Filters">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <StackPanel>
                    <StackPanel Orientation="Horizontal" d:LayoutOverrides="Width">
                        <TextBlock Text="Level:" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="2,2,2,2" Width="50" TextAlignment="Right"/>
                        <TextBox x:Name="MinLevelText" Width="35" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="2,2,2,2" TextChanged="LevelChanged"/>
                        <TextBlock Text="-" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="2,2,4,2"/>
                        <TextBox x:Name="MaxLevelText" Width="35" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="2,2,2,2" TextChanged="LevelChanged"/>
                    </StackPanel>
                    <StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
                        <TextBlock Text="Class:" TextWrapping="Wrap" HorizontalAlignment="Left" Margin="2,2,2,2" VerticalAlignment="Center" Width="50" TextAlignment="Right"/>
                        <ComboBox x:Name="ClassCombo" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="2,2,2,2" Width="110" SelectionChanged="FilterChanged">
                            <ComboBoxItem Content=" "/>
                            <ComboBoxItem Content="Warrior"/>
                            <ComboBoxItem Content="Paladin"/>
                            <ComboBoxItem Content="Hunter"/>
                            <ComboBoxItem Content="Rogue"/>
                            <ComboBoxItem Content="Priest"/>
                            <ComboBoxItem Content="Death Knight"/>
                            <ComboBoxItem Content="Shaman"/>
                            <ComboBoxItem Content="Mage"/>
                            <ComboBoxItem Content="Warlock"/>
                            <ComboBoxItem Visibility="Collapsed"/>
                            <ComboBoxItem Content="Druid"/>
                        </ComboBox>
                    </StackPanel>
                </StackPanel>
                <ListBox x:Name="BindList" Margin="2,2,2,2" Grid.Column="1" Grid.RowSpan="3" SelectionMode="Multiple" Height="120" SelectionChanged="FilterChanged">
                    <ListBoxItem Content="None"/>
                    <ListBoxItem Content="BoP"/>
                    <ListBoxItem Content="BoE"/>
                    <ListBoxItem Content="BoA"/>
                    <ListBoxItem Content="BoU"/>
                </ListBox>
                <ListBox x:Name="SlotList" Margin="2,2,2,2" Grid.Column="2" Grid.RowSpan="3" SelectionMode="Multiple" Height="120" SelectionChanged="FilterChanged">
                    <ListBoxItem Content="None"/>
                    <ListBoxItem Content="Head"/>
                    <ListBoxItem Content="Neck"/>
                    <ListBoxItem Content="Shoulders"/>
                    <ListBoxItem Content="Back"/>
                    <ListBoxItem Content="Chest"/>
                    <ListBoxItem Content="Shirt"/>
                    <ListBoxItem Content="Tabard"/>
                    <ListBoxItem Content="Wrist"/>
                    <ListBoxItem Content="Hands"/>
                    <ListBoxItem Content="Waist"/>
                    <ListBoxItem Content="Legs"/>
                    <ListBoxItem Content="Feet"/>
                    <ListBoxItem Content="Finger"/>
                    <ListBoxItem Content="Trinket"/>
                    <ListBoxItem Content="One Hand"/>
                    <ListBoxItem Content="Two Hand"/>
                    <ListBoxItem Content="Main Hand"/>
                    <ListBoxItem Content="Off Hand"/>
                    <ListBoxItem Content="Ranged"/>
                    <ListBoxItem Content="Meta"/>
                    <ListBoxItem Content="Red"/>
                    <ListBoxItem Content="Orange"/>
                    <ListBoxItem Content="Yellow"/>
                    <ListBoxItem Content="Green"/>
                    <ListBoxItem Content="Blue"/>
                    <ListBoxItem Content="Purple"/>
                    <ListBoxItem Content="Prismatic"/>
                    <ListBoxItem Content="Cogwheel"/>
                    <ListBoxItem Content="Hydraulic"/>
                </ListBox>
                <ListBox x:Name="TypeList" Margin="2,2,2,2" Grid.Column="3" Grid.RowSpan="3" SelectionMode="Multiple" Height="120" SelectionChanged="FilterChanged">
                    <ListBoxItem Content="None"/>
                    <ListBoxItem Content="Cloth"/>
                    <ListBoxItem Content="Leather"/>
                    <ListBoxItem Content="Mail"/>
                    <ListBoxItem Content="Plate"/>
                    <ListBoxItem Content="Dagger"/>
                    <ListBoxItem Content="Fists"/>
                    <ListBoxItem Content="1H Axe"/>
                    <ListBoxItem Content="2H Axe"/>
                    <ListBoxItem Content="1H Mace"/>
                    <ListBoxItem Content="2H Mace"/>
                    <ListBoxItem Content="1H Sword"/>
                    <ListBoxItem Content="2H Sword"/>
                    <ListBoxItem Content="Polearm"/>
                    <ListBoxItem Content="Staff"/>
                    <ListBoxItem Content="Shield"/>
                    <ListBoxItem Content="Bow"/>
                    <ListBoxItem Content="Crossbow"/>
                    <ListBoxItem Content="Gun"/>
                    <ListBoxItem Content="Wand"/>
                    <ListBoxItem Content="Thrown"/>
                    <ListBoxItem Content="Relic"/>
                    <ListBoxItem Content="Arrow"/>
                    <ListBoxItem Content="Bullet"/>
                    <ListBoxItem Content="Quiver"/>
                    <ListBoxItem Content="Ammo Pouch"/>
                </ListBox>
                <ListBox x:Name="QualityList" Margin="2,2,2,2" Grid.Column="4" Grid.RowSpan="3" SelectionMode="Multiple" Height="120" SelectionChanged="FilterChanged">
                    <ListBoxItem Content="Temp"/>
                    <ListBoxItem Content="Poor"/>
                    <ListBoxItem Content="Common"/>
                    <ListBoxItem Content="Uncommon"/>
                    <ListBoxItem Content="Rare"/>
                    <ListBoxItem Content="Epic"/>
                    <ListBoxItem Content="Legendary"/>
                    <ListBoxItem Content="Artifact"/>
                    <ListBoxItem Content="Heirloom"/>
                </ListBox>
            </Grid>
        </toolkit:Expander>
        <StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Row="3" Orientation="Horizontal" Margin="2,0,0,2">
            <Button x:Name="AddButton" Content="Add" Width="75" IsEnabled="True" Click="AddButton_Click" Margin="2,2,2,2"/>
            <Button x:Name="EditButton" Content="Edit" Width="75" IsEnabled="False" Click="EditButton_Click" Margin="2,2,2,2"/>
            <Button x:Name="RefreshButton" Content="Refresh" Width="75" IsEnabled="False" Click="RefreshButton_Click" Margin="2,2,2,2"/>
        </StackPanel>

    </Grid>
</basics2:ChildWindow>